package team.zero.lemon.module.workflow.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import team.zero.lemon.common.exception.CustomException;
import team.zero.lemon.common.service.CrudService;
import team.zero.lemon.module.workflow.dao.IFormDataDao;
import team.zero.lemon.module.workflow.entity.Form;
import team.zero.lemon.module.workflow.entity.FormData;

import java.util.List;

/**
 * Created by bolin on 2016/11/18.
 */
@Service
public class FormDataService extends CrudService<IFormDataDao, FormData> {
    @Transactional
    public void deleteByInstanceId(Integer instanceId,String formName) {
        try {
            dao.deleteByInstanceId(instanceId,formName);
        } catch (Exception ex) {
            throw new CustomException(ex);
        }

    }


    public List<FormData> findbyInstanceId(Integer instanceId) {
        try {
          return   dao.findbyInstanceId(instanceId);
        } catch (Exception ex) {
            throw new CustomException(ex);
        }

    }
}
